package com.test.rabforspringboot.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {

    @Bean
    public Queue fanoutQueue(){
        return new Queue("fanout");
    }
    @Bean
    public Queue fanoutQueue1(){
        return new Queue("fanout1");
    }
    @Bean
    public Queue fanoutQueue2(){
        return new Queue("fanout2");
    }
    @Bean
    public FanoutExchange fanoutExchange(){
        return new FanoutExchange("fanoutExchange");
    }

    @Bean
    public Binding bindingExchange(){
        return BindingBuilder.bind(fanoutQueue()).to(fanoutExchange());
    }
    @Bean
    public Binding bindingExchange1(){
        return BindingBuilder.bind(fanoutQueue1()).to(fanoutExchange());
    }
    @Bean
    public Binding bindingExchange2(){
        return BindingBuilder.bind(fanoutQueue2()).to(fanoutExchange());
    }
}
